package com.humngyang.com.hmy.service;


import com.humngyang.com.hmy.mapper.GoodsCategoryMapper;
import com.humngyang.com.hmy.utils.TreeUtile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.Collections;
import java.util.List;
import java.util.Map;

@Service
public class GoodsCategoryService {


    @Autowired
    GoodsCategoryMapper goodsCategoryMapper;
    
    /**
     * Author : hmy
     * @date 2020/3/4 13:10
     * describution : 树形菜单查询所有的商品分类
     **/

    public List<Map<String,Object>> getAllgoodCategoryTree(){
        List<Map<String, Object>> maps = goodsCategoryMapper.selectMaps(null);
        if (CollectionUtils.isEmpty(maps)){
            return Collections.EMPTY_LIST;
        }
        List<Map<String, Object>> maps1 = TreeUtile.parseTree(maps);
        return maps1;
    }




}
